package org.example.config;

import feign.Logger;
import feign.Retryer;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

@Configuration
public class OrderConfig {

    @LoadBalanced       //注解式负载均衡
    @Bean
    public RestTemplate getRestTemplate()
    {
        return new RestTemplate();
    }


    @Bean
    Logger.Level feignLoggerLevel()
    {
        return Logger.Level.FULL;
    }

    // 配置重试次数
    @Bean
    Retryer retryer(){
        return new Retryer.Default(100, 1000, 2);
    }

}
